package com.foreknow.proxy;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Test {
    public static void main(String[] args) {
//        Button button = new Button();
//        button.addActionListener(new ActionListener() {
//            @Override
//            public void actionPerformed(ActionEvent e) {
//
//            }
//        });

        Dog target = new DogImpl();
        Object proxy =  MyProxyFactory.getProxy(target);
        Dog dog = null;
        //proxy instanceof Dog  p是否是实现了D接口（p是否是D的实现）  实现了才能进行下一步
        if (proxy instanceof Dog) {
            dog = (Dog) proxy;
            dog.info();
            dog.run();
        }

    }
}
